import 'package:bluetooth_protocols_parser_plugin/src/tools/extension_enum.dart';

// 源设备类型
enum TargetDeviceType {
  none(0x00, 0, "无目标设备"),
  app(0x02, 0, "App"),
  eucHmic(0x21, 0, "独轮车人机版"),
  eucDriver(0x22, 0, "独轮车驱动板"),
  eucBle(0x23, 0, "独轮车蓝牙版"),
  eucBMS1(0x24, 0, "独轮车BMS1"),
  eucBMS2(0x25, 0, "独轮车BMS2"),
  eucDc(0x2E, 0, "独轮车屏幕"),
  eucTBox(0x2F, 0, "云盒"),
  scooterDriver(0x31, 0, "滑板车驱动板"),
  scooterDisplay(0x32, 0, "滑板车仪表"),
  scooterLR1Display(0x31, 1, "滑板LR1-仪表设备号"),
  scooterLR1Driver1(0x32, 1, "滑板LR1-驱动板1设备号"),
  scooterLR1Driver2(0x33, 1, "滑板LR1-驱动板2设备号"),
  scooterLR1BMS(0x34, 1, "滑板LR1-BMS设备号"),
  all(0xFF, 0, "全部设备");

  final int rawValue;
  final int sign; // 车型标识，当为0时表示不区分车型，1表示LR1车型
  final String name;
  const TargetDeviceType(this.rawValue, this.sign, this.name);

  // 通过 rawValue 获取枚举类型
  static TargetDeviceType? getTypeByNum(int rawValue, int sign) =>
      TargetDeviceType.values.firstWhereOrNull(
          (activity) => activity.rawValue == rawValue && activity.sign == sign);
}
